<?php
class Conexion
{
	private $servidor;
	private $usuario;
	private $password;
	private	$basededatos;
	
	public function Conexion()
	{
		$this ->servidor="localhost";
		$this ->usuario="root";
		$this ->password="123456";
		$this ->basededatos="dbRenAcademico";
	}
	public function Conectar()
	{
		$conbd= mysqli_connect($this->servidor,$this->usuario, $this->password, $this->basededatos);
		if($conbd)
		{
			return $conbd;
		}
		else
		{
			echo "Error al conectar con la base de datos";
		}
	}
	
	public function Ejecutar($sql)
	{
		$conbd= $this->Conectar();
		return mysqli_query($conbd,$sql);
	}
	
	public function EjecutarTran($sql, $conbd)
	{
		return mysqli_query($conbd, $sql);
	}
	
	public function IniciarTran($conbd)
	{
		return mysqli_query($conbd, "start transaction");
	}
	
	public function AceptarTran($conbd)
	{
		return mysqli_query($conbd, "commit");
	}
	
	public function CancelarTran($conbd)
	{
	 	return mysqli_query($conbd, "rollback");
	}
	
}
?>